home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-11 | 9.7 KB | 556 lines | [TEXT/MPS ] |
- ;
- ; File: ColorPicker.a
- ;
- ; Copyright: © 1984-1994 by Apple Computer, Inc.
- ; All rights reserved.
- ;
- ; Version: Universal Interfaces 2.0a3 ETO #16, MPW prerelease. Friday, November 11, 1994.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
-
- IF &TYPE('__COLORPICKER__') = 'UNDEFINED' THEN
- __COLORPICKER__ SET 1
-
-
- IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
- include 'Quickdraw.a'
- ENDIF
- ; include 'Types.a' ;
- ; include 'ConditionalMacros.a' ;
- ; include 'MixedMode.a' ;
- ; include 'QuickdrawText.a' ;
-
- IF &TYPE('__WINDOWS__') = 'UNDEFINED' THEN
- include 'Windows.a'
- ENDIF
- ; include 'Memory.a' ;
- ; include 'Events.a' ;
- ; include 'OSUtils.a' ;
- ; include 'Controls.a' ;
- ; include 'Menus.a' ;
-
- IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
- include 'Dialogs.a'
- ENDIF
- ; include 'Errors.a' ;
- ; include 'TextEdit.a' ;
-
- IF &TYPE('__CMAPPLICATION__') = 'UNDEFINED' THEN
- include 'CMApplication.a'
- ENDIF
- ; include 'Printing.a' ;
-
- IF &TYPE('__BALLOONS__') = 'UNDEFINED' THEN
- include 'Balloons.a'
- ENDIF
-
- ;Maximum small fract value, as long
- MaxSmallFract EQU $0000FFFF
-
- kDefaultWidth EQU 383
- kDefaultHeight EQU 238
-
- kDidNothing EQU 0
- kColorChanged EQU 1
- kOkHit EQU 2
- kCancelHit EQU 3
- kNewPickerChosen EQU 4
- kApplItemHit EQU 5
-
- kOriginalColor EQU 0
- kNewColor EQU 1
-
- kCut EQU 0
- kCopy EQU 1
- kPaste EQU 2
- kClear EQU 3
- kUndo EQU 4
-
- kMouseDown EQU 0
- kKeyDown EQU 1
- kFieldEntered EQU 2
- kFieldLeft EQU 3
- kCutOp EQU 4
- kCopyOp EQU 5
- kPasteOp EQU 6
- kClearOp EQU 7
- kUndoOp EQU 8
-
- kAtSpecifiedOrigin EQU 0
- kDeepestColorScreen EQU 1
- kCenterOnMainScreen EQU 2
-
- DialogIsMoveable EQU 1
- DialogIsModal EQU 2
- CanModifyPalette EQU 4
- CanAnimatePalette EQU 8
- AppIsColorSyncAware EQU 16
- InSystemDialog EQU 32
- InApplicationDialog EQU 64
- InPickerDialog EQU 128
- DetachedFromChoices EQU 256
- CanDoColor EQU 1
- CanDoBlackWhite EQU 2
- AlwaysModifiesPalette EQU 4
- MayModifyPalette EQU 8
- PickerIsColorSyncAware EQU 16
- CanDoSystemDialog EQU 32
- CanDoApplDialog EQU 64
- HasOwnDialog EQU 128
- CanDetach EQU 256
-
- kNoForcast EQU 0
- kMenuChoice EQU 1
- kDialogAccept EQU 2
- kDialogCancel EQU 3
- kLeaveFocus EQU 4
- kPickerSwitch EQU 5
- kNormalKeyDown EQU 6
- kNormalMouseDown EQU 7
-
- ; A SmallFract value is just the fractional part of a Fixed number,
- ;which is the low order word. SmallFracts are used to save room,
- ;and to be compatible with Quickdraw's RGBColor. They can be
- ;assigned directly to and from INTEGERs.
- ; Unsigned fraction between 0 and 1
- ; For developmental simplicity in switching between the HLS and HSV
- ;models, HLS is reordered into HSL. Thus both models start with
- ;hue and saturation values; value/lightness/brightness is last.
- HSVColor RECORD 0
- hue ds.w 1 ;Fraction of circle, red at 0
- saturation ds.w 1 ;0-1, 0 for gray, 1 for pure color
- value ds.w 1 ;0-1, 0 for black, 1 for max intensity
- sizeof EQU 6
- ENDR
-
- HSLColor RECORD 0
- hue ds.w 1 ;Fraction of circle, red at 0
- saturation ds.w 1 ;0-1, 0 for gray, 1 for pure color
- lightness ds.w 1 ;0-1, 0 for black, 1 for white
- sizeof EQU 6
- ENDR
-
- CMYColor RECORD 0
- cyan ds.w 1
- magenta ds.w 1
- yellow ds.w 1
- sizeof EQU 6
- ENDR
-
- PMColor RECORD 0
- profile ds.l 1
- color ds.l 5
- sizeof EQU 24
- ENDR
-
- PickerIconData RECORD 0
- scriptCode ds.w 1
- iconSuiteID ds.w 1
- helpResType ds.l 1
- helpResID ds.w 1
- sizeof EQU 10
- ENDR
-
- PickerInitData RECORD 0
- pickerDialog ds.l 1
- choicesDialog ds.l 1
- flags ds.l 1
- yourself ds.l 1
- sizeof EQU 16
- ENDR
-
- ; This is the same structure as GX's gxEditMenuRecord. Maybe use that?
- MenuItemInfo RECORD 0
- editMenuID ds.w 1
- cutItem ds.w 1
- copyItem ds.w 1
- pasteItem ds.w 1
- clearItem ds.w 1
- undoItem ds.w 1
- sizeof EQU 12
- ENDR
-
- MenuState RECORD 0
- cutEnabled ds.b 1
- copyEnabled ds.b 1
- pasteEnabled ds.b 1
- clearEnabled ds.b 1
- undoEnabled ds.b 1
- undoString ds.l 64
- sizeof EQU 262
- ENDR
-
- ColorPickerInfo RECORD 0
- theColor ds PMColor
- dstProfile ds.l 1
- flags ds.l 1
- placeWhere ds.w 1
- dialogOrigin ds Point
- pickerType ds.l 1
- eventProc ds.l 1
- colorProc ds.l 1
- colorProcData ds.l 1
- prompt ds.l 64
- mInfo ds MenuItemInfo
- newColorChosen ds.b 1
- filler ds.b 1
- sizeof EQU 324
- ENDR
-
- SystemDialogInfo RECORD 0
- flags ds.l 1
- pickerType ds.l 1
- placeWhere ds.w 1
- dialogOrigin ds Point
- mInfo ds MenuItemInfo
- sizeof EQU 26
- ENDR
-
- PickerDialogInfo RECORD 0
- flags ds.l 1
- pickerType ds.l 1
- dialogOrigin ds.l 1
- mInfo ds MenuItemInfo
- sizeof EQU 24
- ENDR
-
- ApplicationDialogInfo RECORD 0
- flags ds.l 1
- pickerType ds.l 1
- theDialog ds.l 1
- pickerOrigin ds Point
- mInfo ds MenuItemInfo
- sizeof EQU 28
- ENDR
-
- EventData RECORD 0
- event ds.l 1
- action ds.w 1
- itemHit ds.w 1
- handled ds.b 1
- filler ds.b 1
- colorProc ds.l 1
- colorProcData ds.l 1
- forcast ds.w 1
- sizeof EQU 20
- ENDR
-
- EditData RECORD 0
- theEdit ds.w 1
- action ds.w 1
- handled ds.b 1
- filler ds.b 1
- sizeof EQU 6
- ENDR
-
- ItemHitData RECORD 0
- itemHit ds.w 1
- iMod ds.w 1
- action ds.w 1
- colorProc ds.l 1
- colorProcData ds.l 1
- where ds Point
- sizeof EQU 18
- ENDR
-
- HelpItemInfo RECORD 0
- options ds.l 1
- tip ds Point
- altRect ds Rect
- theProc ds.w 1
- helpVariant ds.w 1
- helpMessage ds.w 139
- sizeof EQU 298
- ENDR
-
- ; Below are the color conversion routines.
- IF GENERATING68K THEN
- Macro
- _Fix2SmallFract
- move.w #$0001,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT Fix2SmallFract
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SmallFract2Fix
- move.w #$0002,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT SmallFract2Fix
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _CMY2RGB
- move.w #$0003,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT CMY2RGB
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _RGB2CMY
- move.w #$0004,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT RGB2CMY
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _HSL2RGB
- move.w #$0005,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT HSL2RGB
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _RGB2HSL
- move.w #$0006,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT RGB2HSL
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _HSV2RGB
- move.w #$0007,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT HSV2RGB
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _RGB2HSV
- move.w #$0008,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT RGB2HSV
- ENDIF
-
- ; Below brings up the ColorPicker 1.0 Dialog
- IF GENERATING68K THEN
- Macro
- _GetColor
- move.w #$0009,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT GetColor
- ENDIF
-
- ; Below are the ColorPicker 2.0 routines.
- IF GENERATING68K THEN
- Macro
- _PickColor
- move.w #$0213,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT PickColor
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _AddPickerToDialog
- move.w #$0414,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT AddPickerToDialog
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _CreateColorDialog
- move.w #$0415,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT CreateColorDialog
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _CreatePickerDialog
- move.w #$0416,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT CreatePickerDialog
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DisposeColorPicker
- move.w #$0217,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT DisposeColorPicker
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetPickerVisibility
- move.w #$0418,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT GetPickerVisibility
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetPickerVisibility
- move.w #$0319,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT SetPickerVisibility
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetPickerPrompt
- move.w #$041a,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT SetPickerPrompt
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DoPickerEvent
- move.w #$041b,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT DoPickerEvent
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DoPickerEdit
- move.w #$041c,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT DoPickerEdit
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DoPickerDraw
- move.w #$021d,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT DoPickerDraw
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetPickerColor
- move.w #$051e,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT GetPickerColor
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetPickerColor
- move.w #$051f,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT SetPickerColor
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetPickerOrigin
- move.w #$0420,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT GetPickerOrigin
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetPickerOrigin
- move.w #$0421,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT SetPickerOrigin
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetPickerProfile
- move.w #$0422,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT GetPickerProfile
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _SetPickerProfile
- move.w #$0423,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT SetPickerProfile
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _GetPickerEditMenuState
- move.w #$0424,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT GetPickerEditMenuState
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _ExtractPickerHelpItem
- move.w #$0625,-(sp)
- dc.w $A82E
- EndM
- ELSE
- IMPORT ExtractPickerHelpItem
- ENDIF
-
- ENDIF ; __COLORPICKER__
-